home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / systems / mac / textures / graphics / BoxedEPS.sea.hqx / Boxed EPS / BoxedEPS.tex < prev    next >
Text File  |  1993-01-23  |  26KB  |  804 lines

  1.   %%
  2.  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3.   %%
  4.  %%%%%   BoxedEPS.tex FOR FIGURE INSERTS OF EPSF NORM  %%%%%
  5.  %%%%%   (EPSF = Encapsulated PostScript File)
  6.   %%
  7.  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  8.   %%  
  9.  %%%  AUTHOR: Laurent Siebenmann
  10.   %%    lcs@matups.matups.fr
  11.   %%  
  12.  %%%  VERSIONS: Feb 1991 -- October, 1992
  13.   %%  
  14.  %%%  SOMMAIRE: BoxedEPS.tex d\'efinit des macro-commandes
  15.   %%    qui permettent d'int\'egrer dans un document TeX des 
  16.   %%    objets graphiques d\'ecrits par fichier de norme EPSF,
  17.   %%    tout en accordant a chacun le statut d'une bo\^ite TeX ayant 
  18.   %%    les bonnes dimensions.  La (seule!) contribution unique 
  19.   %%    de ce fichier est de faire cela d'une fa{\c}con universelle.
  20.   %%    C'est a dire de fa{\c}con \`a pouvoir commod\'ement 
  21.   %%    servir avec tout pilote d'imprimante de norme 
  22.   %%    PostScript --- malgr\'e l'absence d'une norme 
  23.   %%    pour \special. 
  24.   %%  
  25.  %%%  POSTINGS: anonymous ftp 
  26.   %%  ---  ftp 130.84.128.100 (alias rsovax.circe.fr); 
  27.   %%  login: anonymous; password: <anything>; directory 
  28.   %%  [anonymous.siebenmann].  This is the master copy in 1992.
  29.   %%  
  30.   %%  ---  ftp 129.69.1.12 (alias rusinfo.rus.uni-stuttgart.de);
  31.   %%  login: anonymous; password: <anything>; 
  32.   %%  directory hints .../tex/graphics/...
  33.   %%  
  34.  %%%% DOCUMENTATION:
  35.   %%  --- see BoxedEPS.doc
  36.   %%  
  37.  %%%% ACTIVATION:
  38.   %%  by a driver-by-driver protocol
  39.   %%  see \SetTexturesEPSFSpecial 
  40.   %%  and its companions below.
  41.   %%  
  42.  
  43.  \ifx\MYUNDEFINED\BoxedEPSF
  44.    \let\temp\relax
  45.  \else
  46.    \message{}
  47.    \message{ !!! BoxedEPS %
  48.          or BoxedArt macros already defined !!!}
  49.    \let\temp\endinput
  50.  \fi
  51.   \temp
  52.  
  53.  \chardef\EPSFCatAt\the\catcode`\@
  54.  \catcode`\@=11
  55.  
  56.  \chardef\C@tColon\the\catcode`\:
  57.  \chardef\C@tSemicolon\the\catcode`\;
  58.  \chardef\C@tQmark\the\catcode`\?
  59.  \chardef\C@tEmark\the\catcode`\!
  60.  \chardef\C@tDqt\the\catcode`\"
  61.  
  62.  \def\PunctOther@{\catcode`\:=12
  63.    \catcode`\;=12 \catcode`\?=12 \catcode`\!=12 \catcode`\"=12}
  64.  \PunctOther@
  65.  
  66.  %%temporarily suppress Plain's logging of allocations
  67.  \let\wlog@ld\wlog 
  68.  \def\wlog#1{\relax} 
  69.  
  70.  %% New for TOOLS
  71.  \newif\ifIN@
  72.  \newdimen\XShift@ \newdimen\YShift@ 
  73.  \newtoks\Realtoks
  74.  
  75.  %%% New for Boxed EPSF
  76.   %
  77.  \newdimen\Wd@ \newdimen\Ht@
  78.  \newdimen\Wd@@ \newdimen\Ht@@
  79.  %
  80.  \newdimen\TT@
  81.  \newdimen\LT@
  82.  \newdimen\BT@
  83.  \newdimen\RT@
  84.  %
  85.  \newdimen\XSlide@ \newdimen\YSlide@ 
  86.  %
  87.  \newdimen\TheScale  %% secretly scale in mils: 1pt= 1mil 
  88.  \newdimen\FigScale  %% secretly scale in mils: 1pt= 1mil 
  89.  %
  90.  \newdimen\ForcedDim@@
  91.  
  92.  \newtoks\EPSFDirectorytoks@
  93.  \newtoks\EPSFNametoks@
  94.  \newtoks\BdBoxtoks@
  95.  \newtoks\LLXtoks@  %% useful info for Oz
  96.  \newtoks\LLYtoks@  
  97.  
  98.   
  99.  \newif\ifNotIn@
  100.  \newif\ifForcedDim@
  101.  \newif\ifForceOn@
  102.  \newif\ifForcedHeight@
  103.  \newif\ifPSOrigin
  104.  
  105.  \newread\EPSFile@ 
  106.  
  107.  %%%% MESSAGES (separate macro needed for Europe)
  108.   %%  
  109.   \def\ms@g{\immediate\write16}
  110.  
  111.  %%%% WORD-PROCESSING MACROS
  112.   %%
  113.   %%% \IN@0#1@#2@ : Is 1st exp of #1 in 1st exp of #2 ??
  114.    %% Answer in \ifIN@
  115.  \newif\ifIN@\def\IN@{\expandafter\INN@\expandafter}
  116.   \long\def\INN@0#1@#2@{\long\def\NI@##1#1##2##3\ENDNI@
  117.     {\ifx\m@rker##2\IN@false\else\IN@true\fi}%
  118.      \expandafter\NI@#2@@#1\m@rker\ENDNI@}
  119.   \def\m@rker{\m@@rker}
  120.  
  121.   %%%  \SPLIT@0#1@#2@  :  Split 1st exp of #2 at 1st exp of #1
  122.    %%  \Initialtoks@ , \Terminaltoks@ will contain pieces
  123.   \newtoks\Initialtoks@  \newtoks\Terminaltoks@
  124.   \def\SPLIT@{\expandafter\SPLITT@\expandafter}
  125.   \def\SPLITT@0#1@#2@{\def\TTILPS@##1#1##2@{%
  126.      \Initialtoks@{##1}\Terminaltoks@{##2}}\expandafter\TTILPS@#2@}
  127.  
  128.  %%%% MACROS TO TRIM  \ForeTrim@0#1@ and \Trim@0#1@  
  129.    %% result appears in \Trimtoks@
  130.    %% LIMITATION: assume no multiple spaces to trim
  131.  
  132.   \newtoks\Trimtoks@
  133.  
  134.   %%% \ForeTrim@0#1@ trims initial space of first erpansion of #1
  135.    %% #1 of form \the\toks0 or \mymacro
  136.  \def\ForeTrim@{\expandafter\ForeTrim@@\expandafter}
  137.  \def\ForePrim@0 #1@{\Trimtoks@{#1}}
  138.  \def\ForeTrim@@0#1@{\IN@0\m@rker. @\m@rker.#1@%
  139.      \ifIN@\ForePrim@0#1@%
  140.      \else\Trimtoks@\expandafter{#1}\fi}
  141.    %%\m@rker expands here to \m@@rker since spot initial,
  142.    %% so no confusuion with \m@rker
  143.  
  144.   %%% \Trim@0#1@ trims init and terminal spaces 
  145.    %% Same syntax.
  146.    %% Warns if internal spaces found.
  147.    %% 
  148.   \def\Trim@0#1@{%
  149.       \ForeTrim@0#1@%
  150.       \IN@0 @\the\Trimtoks@ @%
  151.         \ifIN@ 
  152.              \SPLIT@0 @\the\Trimtoks@ @\Trimtoks@\Initialtoks@
  153.              \IN@0\the\Terminaltoks@ @ @%
  154.                  \ifIN@
  155.                  \else \Trimtoks@ {FigNameWithSpace}%
  156.                  \fi
  157.         \fi
  158.       }
  159.  
  160.  
  161.   %%%% MATH MACROS (provisional)
  162.     %% use dimen registers for reals; unit 1pt
  163.     %% (numerical dimension arguments OK unless contrary noted)
  164.  
  165.   %%%% One needs the point token seq (pt with cat 12) USES dimen 0
  166.    \newtoks\pt@ks
  167.    \def \getpt@ks 0.0#1@{\pt@ks{#1}}
  168.    \dimen0=0pt\relax\expandafter\getpt@ks\the\dimen0@
  169.  
  170.    %%% Convert dimen to "decimal multiplier"% USES dimens 0,2
  171.   \newtoks\Realtoks% the output!
  172.   \def\Real#1{%
  173.     \dimen2=#1%
  174.       \SPLIT@0\the\pt@ks @\the\dimen2@%%  lop off the points
  175.        \Realtoks=\Initialtoks@%\showthe\Realtoks
  176.             }
  177.  
  178.    %%% Multiplication 
  179.       % USES dimens 0,2,4,6; preserves args; output \Product
  180.    \newdimen\Product
  181.    \def\Mult#1#2{%
  182.      \dimen4=#1\relax
  183.      \dimen6=#2%
  184.      \Real{\dimen4}%
  185.      \Product=\the\Realtoks\dimen6%
  186.         }
  187.  
  188.    %%% Inverse 
  189.      % USES dimens 0; preserves arg; output \Inverse
  190.  \newdimen\Inverse
  191.  \newdimen\hmxdim@ \hmxdim@=8192pt%halfmaxdimen
  192.  \def\Invert#1{%
  193.   \Inverse=\hmxdim@
  194.   \dimen0=#1%
  195.   \divide\Inverse \dimen0%
  196.   \multiply\Inverse 8}
  197.  
  198.  %%% \Rescale#1#2#3  % USES dimens 0,2,4,6
  199.   %%  alters dimen register #1 by ratio #2/#3 
  200.   %%  where #2,#3 can be raw dimensions OR dimen registers
  201.    \def\Rescale#1#2#3{% Adequate accuracy. Can improve. 
  202.               \divide #1 by 100\relax
  203.               \dimen2=#3\divide\dimen2 by 100 \Invert{\dimen2}% 
  204.               \Mult{#1}{#2}%
  205.               \Mult\Product\Inverse 
  206.               #1=\Product}
  207.  
  208.  %%% \Scale#1 scales dimen register #1 
  209.    %  by dimen register real \TheScale; USES dimens 0
  210.   \def\Scale#1{\dimen0=\TheScale %
  211.       \divide #1 by  1280 %% 1280*5120*10=1000*2^16 
  212.       \divide \dimen0 by 5120 % 
  213.       \multiply#1 by \dimen0 
  214.       \divide#1 by 10   %% max size of #1 about 32000/10 pt
  215.      }
  216.  
  217.  %%% SCRUNCHING BOXES AND SHIFTING CONTENTS
  218.   %% TeX has to do this in general
  219.   %% since some drivers do not let 
  220.   %% one do it readily using Postscript
  221.  
  222.  \newbox\scrunchbox
  223.  
  224.  %%% \Scrunched#1 puts #1 in an hbox
  225.   %%    then in effect zeros the dimensions of this box
  226.  \def\Scrunched#1{{\setbox\scrunchbox\hbox{#1}%
  227.    \wd\scrunchbox=0pt
  228.    \ht\scrunchbox=0pt
  229.    \dp\scrunchbox=0pt
  230.    \box\scrunchbox}}
  231.  
  232.   %%% \Shifted@#1 puts #1 in \hbox 
  233.    %% then locates basepoint to bottom left corner
  234.    %% then translates ink only by \XShift@,\YShift@
  235.    %% with Postscript convention
  236.    %% For simplicity use only on scrunched boxes
  237.   %\newdimen\XShift@ 
  238.   %\newdimen\YShift@ 
  239.  \def\Shifted@#1{%
  240.    \vbox {\kern-\YShift@
  241.        \hbox {\kern\XShift@\hbox{#1}\kern-\XShift@}%
  242.            \kern\YShift@}}
  243.  
  244.   %%% \cBoxedEPSF#1 the main macro
  245.    %%  component macros are explained in order below
  246.  
  247.  \def\cBoxedEPSF#1{{\leavevmode 
  248.     %% double brace for amstex \allign, \alligned, ...
  249.    \ReadNameAndScale@{#1}%
  250.    \SetEPSFSpec@
  251.    \ReadEPSFile@ \ReadBdB@x  
  252.    %% Calculations
  253.      \TrimFigDims@ 
  254.      \CalculateFigScale@  
  255.      \ScaleFigDims@
  256.      \SetInkShift@
  257.    \hbox{$\mathsurround=0pt\relax
  258.          \vcenter{\hbox{%
  259.              \FrameSpider{\hskip-.4pt\vrule}%
  260.              \vbox to \Ht@{\offinterlineskip\parindent=\z@%
  261.                 \FrameSpider{\vskip-.4pt\hrule}\vfil 
  262.                 \hbox to \Wd@{\hfil}%
  263.                 \vfil
  264.                 \InkShift@{\EPSFSpecial{\EPSFSpec@}{\FigSc@leReal}}%
  265.              \FrameSpider{\hrule\vskip-.4pt}}%
  266.          \FrameSpider{\vrule\hskip-.4pt}}}%
  267.      $}%
  268.     \CleanRegisters@ 
  269.     \ms@g{ *** Box composed for the % 
  270.          EPSF file \the\EPSFNametoks@}%
  271.     }}
  272.  
  273.  \def\tBoxedEPSF#1{\setbox4\hbox{\cBoxedEPSF{#1}}%
  274.      \setbox4\hbox{\raise -\ht4 \hbox{\box4}}%
  275.      \box4
  276.       }
  277.  
  278.  \def\bBoxedEPSF#1{\setbox4\hbox{\cBoxedEPSF{#1}}%
  279.      \setbox4\hbox{\raise \dp4 \hbox{\box4}}%
  280.      \box4
  281.       }
  282.  
  283.   \let\BoxedEPSF\cBoxedEPSF% default setting
  284.  
  285.   %% Some compatibility with BoxedArt.tex
  286.    %
  287.    \let\BoxedArt\BoxedEPSF
  288.  
  289.   %% Some compatibility with Sweet-teX
  290.    %
  291.   \def\gLinefigure[#1scaled#2]_#3{%
  292.         \BoxedEPSF{#3 scaled #2}}
  293.     
  294.   %% Some compatibility with Rokicki's dvips
  295.    %
  296.   \let\EPSFbox\bBoxedEPSF \let\EPSFfile\bBoxedEPSF
  297.   
  298.   \def\EPSFxsize{\afterassignment\ForceW@\ForcedDim@@}
  299.       \def\ForceW@{\ForcedDim@true\ForcedHeight@false}
  300.   
  301.   \def\EPSFysize{\afterassignment\ForceH@\ForcedDim@@}
  302.       \def\ForceH@{\ForcedDim@true\ForcedHeight@true}
  303.  
  304.   \def\EmulateRokicki{%
  305.        \let\epsfbox\bBoxedEPSF \let\epsffile\bBoxedEPSF
  306.        \let\epsfxsize\EPSFxsize \let\epsfysize\EPSFysize} 
  307.  
  308.  %%% \ReadNameAndScale@#1
  309.   %
  310.  \def\ReadNameAndScale@#1{\IN@0 scaled@#1@% DOUBLE BARRELED
  311.    \ifIN@\ReadNameAndScale@@0#1@%
  312.    \else \ReadNameAndScale@@0#1 scaled\DefaultMilScale @%
  313.    \fi}
  314.   
  315.  \def\ReadNameAndScale@@0#1scaled#2@{% HELPER MACRO
  316.     \let\OldBackslash@\\%
  317.     \def\\{\OtherB@ckslash}%
  318.     \edef\temp@{#1}%
  319.     \Trim@0\temp@ @%
  320.     \EPSFNametoks@\expandafter{\the\Trimtoks@ }%
  321.     \FigScale=#2 pt%
  322.     \let\\\OldBackslash@
  323.     }
  324.  
  325.  \def\SetDefaultEPSFScale#1{%
  326.       \global\def\DefaultMilScale{#1}}
  327.  
  328.  \SetDefaultEPSFScale{1000}
  329.  
  330.  
  331.  %%% \ReadEPSFile@
  332.   %
  333.  \def \SetBogusBbox@{%
  334.      \global\BdBoxtoks@{ BoundingBox:0 0 100 100 }%
  335.      \global\def\BdBoxLine@{ BoundingBox:0 0 100 100 }%
  336.      \ms@g{ !!! Will use placeholder !!!}%
  337.      }
  338.  
  339.  {\catcode`\%=12\gdef\P@S@{%!}} %% %! min sign of PS file
  340.  
  341.  \def\ReadEPSFile@{%\show\EPSFSpec@%
  342.      \openin\EPSFile@\EPSFSpec@
  343.      \relax  %necessary to prevent precocious expansion of \ifeof
  344.   \ifeof\EPSFile@
  345.      \ms@g{}%
  346.      \ms@g{ !!! EPS FILE \the\EPSFDirectorytoks@
  347.        \the\EPSFNametoks@\space WAS NOT FOUND !!!}%
  348.      \SetBogusBbox@
  349.   \else%\fi
  350.    \begingroup%%
  351.    \catcode`\%=12\catcode`\:=12\catcode`\!=12
  352.    \catcode`\G=14\catcode`\\=14\relax% 14 is comment
  353.    \global\read\EPSFile@ to \BdBoxLine@%\show\BdBoxLine@
  354.    \IN@0\P@S@ @\BdBoxLine@ @%
  355.    \ifIN@ %% %! accepted as %!PS so do BdBox search!!
  356.      \NotIn@true
  357.      \loop   
  358.        \ifeof\EPSFile@\NotIn@false 
  359.          \ms@g{}%
  360.          \ms@g{ !!! BoundingBox NOT FOUND IN %
  361.             \the\EPSFDirectorytoks@\the\EPSFNametoks@\space!!! }%
  362.          \SetBogusBbox@
  363.        \else\global\read\EPSFile@ to \BdBoxLine@
  364.        %\show\BdBoxLine@
  365.        \fi
  366.        \global\BdBoxtoks@\expandafter{\BdBoxLine@}%
  367.        \IN@0BoundingBox:@\the\BdBoxtoks@ @%
  368.        \ifIN@\NotIn@false\fi%
  369.      \ifNotIn@\repeat
  370.    \else
  371.          \ms@g{}%
  372.          \ms@g{ !!! \the\EPSFNametoks@\space not PS!\space !!!}%
  373.          \SetBogusBbox@
  374.    \fi
  375.   \endgroup\relax
  376.   \fi
  377.   \closein\EPSFile@ 
  378.    }
  379.  
  380.  
  381.   %%% \ReadBdB@x
  382.    % Rmk For simplicity 0 not used in syntax 
  383.    %  of \ReadBdB@x@,  \ReadBdB@x@@ 
  384.   \def\ReadBdB@x{% PART 0
  385.    \expandafter\ReadBdB@x@\the\BdBoxtoks@ @}
  386.   
  387.   \def\ReadBdB@x@#1BoundingBox:#2@{% PART 1
  388.     \ForeTrim@0#2@%
  389.     \IN@0atend@\the\Trimtoks@ @%
  390.        \ifIN@\Trimtoks@={0 0 100 100 }%
  391.          \ms@g{}%
  392.          \ms@g{ !!! BoundingBox not found in %
  393.          \the\EPSFDirectorytoks@\the\EPSFNametoks@\space !!!}%
  394.          \ms@g{ !!! It must not be at end of EPSF !!!}%
  395.          \ms@g{ !!! Will use placeholder !!!}%
  396.        \fi%% cf \SetBogusBbox@
  397.     \expandafter\ReadBdB@x@@\the\Trimtoks@ @%
  398.    }
  399.     
  400.   \def\ReadBdB@x@@#1 #2 #3 #4@{% PART 2
  401.       \Wd@=#3bp\advance\Wd@ by -#1bp%
  402.       \Ht@=#4bp\advance\Ht@ by-#2bp%
  403.        \Wd@@=\Wd@ \Ht@@=\Ht@ %% useful info for Clark
  404.        \LLXtoks@={#1}\LLYtoks@={#2}%% useful info for Oz
  405.       \ifPSOrigin\XShift@=-#1bp\YShift@=-#2bp\fi 
  406.      }
  407.  
  408.   %%% \SetEPSFDirectory 
  409.    %
  410.    \def\G@bbl@#1{}
  411.    \bgroup
  412.      \global\edef\OtherB@ckslash{\expandafter\G@bbl@\string\\}
  413.    \egroup
  414.  
  415.   \def\SetEPSFDirectory{%  Part 1
  416.            \bgroup\PunctOther@\relax
  417.            \let\\\OtherB@ckslash
  418.            \SetEPSFDirectory@}
  419.  
  420.  \def\SetEPSFDirectory@#1{% Part 2
  421.     \edef\temp@{#1}%
  422.     \Trim@0\temp@ @%  result in \Trimtoks@
  423.     \global\toks1\expandafter{\the\Trimtoks@ }\relax
  424.     \egroup
  425.     \EPSFDirectorytoks@=\toks1
  426.     }
  427.  
  428.   %%% \SetEPSFSpec@
  429.  \def\SetEPSFSpec@{%
  430.      \bgroup
  431.      \let\\=\OtherB@ckslash
  432.      \global\edef\EPSFSpec@{%
  433.         \the\EPSFDirectorytoks@\the\EPSFNametoks@}%
  434.      \global\edef\EPSFSpec@{\EPSFSpec@}%
  435.      \egroup}
  436.    
  437.  
  438.  %%% \TrimFigDims@ 
  439.   % 
  440.  \def\TrimTop#1{\advance\TT@ by #1}
  441.  \def\TrimLeft#1{\advance\LT@ by #1}
  442.  \def\TrimBottom#1{\advance\BT@ by #1}
  443.  \def\TrimRight#1{\advance\RT@ by #1}
  444.  
  445.  \def\TrimBoundingBox#1{%
  446.    \TrimTop{#1}%
  447.    \TrimLeft{#1}%
  448.    \TrimBottom{#1}%
  449.    \TrimRight{#1}%
  450.        }
  451.  
  452.  \def\TrimFigDims@{%
  453.     \advance\Wd@ by -\LT@ 
  454.     \advance\Wd@ by -\RT@ \RT@=\z@
  455.     \advance\Ht@ by -\TT@ \TT@=\z@
  456.     \advance\Ht@ by -\BT@ 
  457.     }
  458.  
  459.  
  460.  %%% \CalculateFigScale@
  461.   %
  462.   \def\ForceWidth#1{\ForcedDim@true
  463.        \ForcedDim@@#1\ForcedHeight@false}
  464.   
  465.   \def\ForceHeight#1{\ForcedDim@true
  466.        \ForcedDim@@=#1\ForcedHeight@true}
  467.  
  468.   \def\ForceOn{\ForceOn@true}
  469.   \def\ForceOff{\ForceOn@false\ForcedDim@false}
  470.   
  471.   \def\CalculateFigScale@{%
  472.             %Have default \FigScale or read \FigScale
  473.      \ifForcedDim@\FigScale=1000pt% %% start afresh
  474.            \ifForcedHeight@
  475.                 \Rescale\FigScale\ForcedDim@@\Ht@
  476.            \else
  477.                 \Rescale\FigScale\ForcedDim@@\Wd@
  478.            \fi
  479.      \fi
  480.      \Real{\FigScale}%
  481.      \edef\FigSc@leReal{\the\Realtoks}%
  482.      }
  483.    
  484.   \def\ScaleFigDims@{\TheScale=\FigScale
  485.       \ifForcedDim@
  486.            \ifForcedHeight@ \Ht@=\ForcedDim@@  \Scale\Wd@
  487.            \else \Wd@=\ForcedDim@@ \Scale\Ht@
  488.            \fi
  489.       \else \Scale\Wd@\Scale\Ht@        
  490.       \fi
  491.       \ifForceOn@\relax\else\global\ForcedDim@false\fi
  492.       \Scale\LT@\Scale\BT@  %%%\Scale\Wd@\Scale\Ht@
  493.       \Scale\XShift@\Scale\YShift@
  494.       }
  495.       
  496.   %%% \ShowReservedBoxes
  497.    %%  shows (prints) corrected scaled and positioned
  498.    %%  bounding boxes; for diagnostics
  499.   %%% \HideReservedBoxes makes them invisible again
  500.    %%
  501.  \def\HideReservedBoxes{\global\def\FrameSpider##1{\null}}
  502.  \def\ShowReservedBoxes{\global\def\FrameSpider##1{##1}}
  503.  \let\HideDisplacementBoxes\HideReservedBoxes  %% some synonyms
  504.  \let\ShowDisplacementBoxes\ShowReservedBoxes
  505.  \let\HideFigureFrames\HideReservedBoxes
  506.  \let\ShowFigureFrames\ShowReservedBoxes
  507.   \ShowDisplacementBoxes
  508.  
  509.   %%% \hSlide#1, \vSlide#1
  510.    %%
  511.  \def\hSlide#1{\advance\XSlide@ by #1}
  512.  \def\vSlide#1{\advance\YSlide@ by #1}
  513.  
  514.   %%% \SetInkShift@, \InkShift@#1
  515.    %%
  516.   \def\SetInkShift@{%
  517.             \advance\XShift@ by -\LT@
  518.             \advance\XShift@ by \XSlide@
  519.             \advance\YShift@ by -\BT@
  520.             \advance\YShift@ by -\YSlide@
  521.              }
  522.    %
  523.   \def\InkShift@#1{\Shifted@{\Scrunched{#1}}}
  524.  
  525.   %%% \CleanRegisters@
  526.    %
  527.   \def\CleanRegisters@{%
  528.       \globaldefs=1\relax
  529.         \XShift@=\z@\YShift@=\z@\XSlide@=\z@\YSlide@=\z@
  530.         \TT@=\z@\LT@=\z@\BT@=\z@\RT@=\z@
  531.       \globaldefs=0\relax}
  532.  
  533.  %%% Special syntax for several drivers. The macros 
  534.   %% \SetTexturesEPSFSpecial  %% Textures 
  535.   %% \SetUnixCoopEPSFSpecial %% dvi2ps early unix 
  536.   %% \SetBechtolsheimDVI2PSEPSFSpecial and 
  537.   %% \SetBechtolsheimDVITPSEPSFSpecial %% by S.P.Bechtolsheim
  538.   %% \SetLisEPSFSpecial %% dvi2ps by Tony Lis
  539.   %% \SetRokickiEPSFSpecial  %% dvips by Tom Rokicki
  540.   %%  --- also for DVIReader, in DirectTeX by W. Ricken
  541.   %% \SetOzTeXEPSFSpecial  %% OzTeX (>=1.42) by Andrew Trevorrow
  542.   %% \SetPSprintEPSFSpecial %% PSprint by Andrew Trevorrow
  543.   %%  --- also for OzTeX versions <= 1.41 !!
  544.   %% \SetArborEPSFSpecial  %% ArborTeX DVILASER/PS
  545.   %% \SetClarkEPSFSpecial %% dvitops by James Clark
  546.   %% \SetDVIPSoneEPSFSpecial %% DVIPSONE of Y&Y 
  547.   %% \SetBeebeEPSFSpecial %% DVIALW by N. Beebe
  548.   %% \SetNorthlakeEPSFSpecial %% Northlake Software
  549.   %% \SetStandardEPSFSpecial %% Nonexistant: Placebo below
  550.   %% Many drivers supported roughly
  551.   %% by (re-)defining the macro \EPSFSpecial#1#2, where
  552.   %% #1 = EPS file pathname (use \\ for the letter backslash)
  553.   %% #2 = scale in mils 
  554.   %% Be wary of using strange characters in pathnames!
  555.  
  556.  %% Textures, Blue Sky Research, Barry Smith
  557.  \def\SetTexturesEPSFSpecial{\PSOriginfalse%\PSOrigintrue
  558.   \gdef\EPSFSpecial##1##2{\relax
  559.     \edef\specialthis{##2}%
  560.     \SPLIT@0.@\specialthis.@\relax
  561.     \special{illustration ##1 scaled
  562.                         \the\Initialtoks@}}}
  563.  
  564.   %% Unix : dvi2ps by:  Mark Senn, Stephan  Bechtolsheim,  
  565.    % Bob  Brown, Richard, Furuta, James Schaad, Robert  Wells, 
  566.    % Norm Hutchinson, Neal Holt, Scott Jones, Howard Trickey.
  567.    % Introduced by B. Horn <bkph@ai.mit.edu>
  568.   \def\SetUnixCoopEPSFSpecial{\PSOrigintrue % Please test!
  569.    \gdef\EPSFSpecial##1##2{%
  570.       \dimen4=##2pt% convert real to dimen
  571.       \divide\dimen4 by 1000\relax
  572.       \Real{\dimen4}%dimens 0,2 used here
  573.       \edef\Aux@{\the\Realtoks}%  
  574.       %%convert dimen to real
  575.       \special{psfile=##1\space 
  576.         hscale=\Aux@\space
  577.         vscale=\Aux@}}}
  578.  
  579.   %% dvi2ps and dvitps by S.P. Bechtolsheim,
  580.    % Introduced by B. Horn <bkph@ai.mit.edu> and Carl.M.Jones, 
  581.    % testing by R. Evans <Robert@cm.cardiff.ac.uk>
  582.    % Note that a prolog file psfig.pro
  583.    % specific to the driver should be available.
  584.   \def\SetBechtolsheimEPSFSpecial@{%% tool macro only
  585.    \PSOrigintrue
  586.    \special{\DriverTag@ Include0 "psfig.pro"}%
  587.    \gdef\EPSFSpecial##1##2{%
  588.       \dimen4=##2pt %% convert real to dimen
  589.       \divide\dimen4 by 1000\relax
  590.       \Real{\dimen4} %% dimens 0,2 used here
  591.       \edef\Aux@{\the\Realtoks}%% convert dimen to real
  592.       \special{\DriverTag@ Literal "10 10 0 0 10 10 startTexFig
  593.            \the\mag\space 1000 div 3.25 neg mul 
  594.            \the\mag\space 1000 div .25 neg mul translate %% correction
  595.            \the\mag\space 1000 div \Aux@\space mul 
  596.            \the\mag\space 1000 div \Aux@\space mul scale "}%
  597.       \special{\DriverTag@ Include1 "##1"}%
  598.       \special{\DriverTag@ Literal "endTexFig "}%
  599.         }}
  600.  
  601.   %% dvi2ps and dvitps by S.P. Bechtolsheim,
  602.    % Introduced by B. Horn <bkph@ai.mit.edu> and Carl.M.Jones, 
  603.    % testing by R. Evans <Robert@cm.cardiff.ac.uk>
  604.    % Note that a prolog file psfig.pro
  605.    % specific to the driver should be available.
  606.   \def\SetBechtolsheimEPSFSpecial@{%% tool macro only
  607.    \PSOrigintrue
  608.    \special{\DriverTag@ Include0 "psfig.pro"}%
  609.    \gdef\EPSFSpecial##1##2{%
  610.       \dimen4=##2pt %% convert real to dimen
  611.       \divide\dimen4 by 1000\relax
  612.       \Real{\dimen4} %% dimens 0,2 used here
  613.       \edef\Aux@{\the\Realtoks}%% convert dimen to real
  614.       \special{\DriverTag@ Literal "10 10 0 0 10 10 startTexFig
  615.            \the\mag\space 1000 div 
  616.            dup 3.25 neg mul 2 index .25 neg mul translate %% correction line
  617.            \Aux@\space mul dup scale "}%
  618.       \special{\DriverTag@ Include1 "##1"}%
  619.       \special{\DriverTag@ Literal "endTexFig "}%
  620.         }}
  621.  
  622.   \def\SetBechtolsheimDVITPSEPSFSpecial{\def\DriverTag@{dvitps: }%
  623.       \SetBechtolsheimEPSFSpecial@}
  624.  
  625.   \def\SetBechtolsheimDVI2PSEPSFSSpecial{\def\DriverTag@{DVI2PS: }%
  626.       \SetBechtolsheimEPSFSpecial@}
  627.  
  628.   %% dvi2ps by Tony Lis,
  629.    % implantations? ; dates?; availability?
  630.    % Introduced by B. Horn <bkph@ai.mit.edu>
  631.   \def\SetLisEPSFSpecial{\PSOrigintrue 
  632.    \gdef\EPSFSpecial##1##2{%
  633.       \dimen4=##2pt% convert real to dimen
  634.       \divide\dimen4 by 1000\relax
  635.       \Real{\dimen4}% dimens 0,2 used here
  636.       \edef\Aux@{\the\Realtoks}%  
  637.       %%convert dimen to real
  638.       \special{pstext="10 10 0 0 10 10 startTexFig\space
  639.            \the\mag\space 1000 div \Aux@\space mul 
  640.            \the\mag\space 1000 div \Aux@\space mul scale"}%
  641.       \special{psfile=##1}%
  642.       \special{pstext=endTexFig}%
  643.         }}
  644.  
  645.   %% dvips by Tom Rokicki; free driver in portable C 
  646.    % Introduced by W.D. Neumann <neumann@mps.ohio-state.edu>
  647.   \def\SetRokickiEPSFSpecial{\PSOrigintrue 
  648.    \gdef\EPSFSpecial##1##2{%
  649.       \dimen4=##2pt% convert real to dimen
  650.       \divide\dimen4 by 10\relax
  651.       \Real{\dimen4}% dimens 0,2 used here
  652.       \edef\Aux@{\the\Realtoks}%  
  653.       %%convert dimen to real
  654.       \special{psfile="##1"\space 
  655.         hscale=\Aux@\space
  656.         vscale=\Aux@}}}
  657.  
  658.   \def\SetInlineRokickiEPSFSpecial{\PSOrigintrue 
  659.    \gdef\EPSFSpecial##1##2{%
  660.       \dimen4=##2pt% convert real to dimen
  661.       \divide\dimen4 by 1000\relax
  662.       \Real{\dimen4}% dimens 0,2 used here
  663.       \edef\Aux@{\the\Realtoks}%  
  664.       %%convert dimen to real
  665.       \special{ps::[begin] 10 10 0 0 10 10 startTexFig\space
  666.            \the\mag\space 1000 div \Aux@\space mul 
  667.            \the\mag\space 1000 div \Aux@\space mul scale}%
  668.       \special{ps: plotfile ##1}%
  669.       \special{ps::[end] endTexFig}%
  670.         }}
  671.  
  672.  %%%  OzTeX (versions 1.42 and later), by Andrew Trevorrow
  673.  %%%  (for earlier versions see PSprint below!!)
  674.  %%  complete public domain TeX for Macintosh
  675.  %%  Send 10 UNFORMATTED 800K disks 
  676.  %%  with return postage to
  677.  %%  Peter Abbott, Computing Service, 
  678.  %%  Aston University, Aston Triangle, Birmingham B4 7ET
  679.  %%  Posting: ftp   midway.uchicago.edu
  680.  %%  Nota: Version 1.42 may give
  681.  %%  spurious "offpage" error notices on printing.
  682.  %%  Nota: Support for MacPaint files not here yet.
  683.  \def\SetOzTeXEPSFSpecial{\PSOrigintrue
  684.  \gdef\EPSFSpecial##1##2{%
  685.  \dimen4=##2pt%% convert real to dimen
  686.  \divide\dimen4 by 1000\relax
  687.  \Real{\dimen4}%% dimens 0,2 used here
  688.  \edef\Aux@{\the\Realtoks}%% convert dimen to real
  689.  \special{epsf=\string"##1\string"\space scale=\Aux@}%
  690.  }} 
  691.  
  692.  %% PSprint, by AndrewTrevorrow for VaX VMS
  693.  %% and OzTeX versions <= 1.41  
  694.   % tested 2-91 by Max Calviani <ISICA@ASTRPD.infn.it>
  695.   \def\SetPSprintEPSFSpecial{\PSOriginFALSE % artifice; see below
  696.    \gdef\EPSFSpecial##1##2{%note order
  697.      \special{##1\space 
  698.        ##2 1000 div \the\mag\space 1000 div mul
  699.        ##2 1000 div \the\mag\space 1000 div mul scale
  700.        \the\LLXtoks@\space neg \the\LLYtoks@\space neg translate
  701.        }}}
  702.  
  703.  %% DVILASER/PS driver originally written by David Fuchs
  704.   % marketed and supported by ArborTeXt  535 W. William St.
  705.   % Suite 300, Ann Arbor, MI 48103, U.S.A
  706.   % (313) 996-3566 (313) 996-3573
  707.   % help@arbortext.com, Andrew Dobrowolski
  708.  \def\SetArborEPSFSpecial{\PSOriginfalse % check!
  709.    \gdef\EPSFSpecial##1##2{%
  710.      \edef\specialthis{##2}%
  711.      \SPLIT@0.@\specialthis.@\relax % suppress decimals (nec!)
  712.      \special{ps: epsfile ##1\space \the\Initialtoks@}}}
  713.  
  714.  %% dvitops, (c) James Clark <jjc@jclark.uucp>
  715.   % public domain; distributed by UK TeX Archive
  716.   % computers: unix, msdos, vms, primos and vm/cms,
  717.   % introduced by S. Ratz <spqr@uk.ac.southampton.ecs>
  718.  \def\SetClarkEPSFSpecial{\PSOriginfalse % please test!
  719.    \gdef\EPSFSpecial##1##2{%
  720.      \Rescale {\Wd@@}{##2pt}{1000pt}%
  721.      \Rescale {\Ht@@}{##2pt}{1000pt}%
  722.      \special{dvitops: import 
  723.            ##1\space\the\Wd@@\space\the\Ht@@}}}
  724.  
  725.  %% DVIPSONE, for PC compatibles
  726.   % Y&Y, 106 Indian Hill, Carlisle MA 01741, USA
  727.   % (508) 371-3286
  728.   % (introduced by B. Horn <bkph@ai.mit.edu>)
  729.   \let\SetDVIPSONEEPSFSpecial\SetUnixCoopEPSFSpecial
  730.   \let\SetDVIPSoneEPSFSpecial\SetUnixCoopEPSFSpecial
  731.  
  732.  %% DVIALW by N. Beebe, public domain 
  733.   % DVI Driver Distribution, Center for Scientific Computing,
  734.   % Department of Mathematics, 220 South Physics Building,
  735.   % University of Utah, Salt Lake City, UT 84112, USA
  736.   % (introduced by B. Horn <bkph@ai.mit.edu>)
  737.   % Proposed standard; see TUGboat article 1993.
  738.   \def\SetBeebeEPSFSpecial{%please test!
  739.    \PSOriginfalse% 
  740.    \gdef\EPSFSpecial##1##2{\relax
  741.     \special{language "PS",
  742.       literal "##2 1000 div ##2 1000 div scale",
  743.       position = "bottom left",
  744.       include "##1"}}}
  745.   \let\SetDVIALWEPSFSpecial\SetBeebeEPSFSpecial
  746.  
  747.  %% Northlake software
  748.   \def\SetNorthlakeEPSFSpecial{\PSOrigintrue
  749.    \gdef\EPSFSpecial##1##2{%
  750.      \edef\specialthis{##2}%
  751.      \SPLIT@0.@\specialthis.@\relax % suppress decimals (nec!)
  752.      \special{insert ##1,magnification=\the\Initialtoks@}}}
  753.  
  754.  \def\SetStandardEPSFSpecial{%
  755.    \gdef\EPSFSpecial##1##2{%
  756.      \ms@g{}
  757.      \ms@g{%
  758.        !!! Sorry! There is still no standard for \string%
  759.        \special\space EPSF integration !!!}%
  760.      \ms@g{%
  761.       --- So you will have to identify your driver using a command}%
  762.      \ms@g{%
  763.       --- of the form \string\Set...EPSFSpecial, in order to get}%
  764.      \ms@g{%
  765.       --- your graphics to print.  See BoxedEPS.doc.}%
  766.      \ms@g{}
  767.      \gdef\EPSFSpecial####1####2{}
  768.      }}
  769.  
  770.   \SetStandardEPSFSpecial %% currently gives warning
  771.  
  772.  \let\wlog\wlog@ld %%restore logging 
  773.  
  774.  \catcode`\:=\C@tColon
  775.  \catcode`\;=\C@tSemicolon
  776.  \catcode`\?=\C@tQmark
  777.  \catcode`\!=\C@tEmark
  778.  \catcode`\"=\C@tDqt
  779.  
  780.  \catcode`\@=\EPSFCatAt
  781.  
  782.   \endinput
  783.  
  784. %%%%%%%%%%%% ASCII Character test
  785.  %
  786.  %       Upper case letters: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  787.  %       Lower case letters: abcdefghijklmnopqrstuvwxyz
  788.  %                                   Digits: 0123456789
  789.  % Square, curly, angle braces, parentheses: [] {} <> ()
  790.  %           Backslash, slash, vertical bar: \ / |
  791.  %                              Punctuation: . ? ! , : ;
  792.  %          Underscore, hyphen, equals sign: _ - =
  793.  %                Quotes--right left double: ' ` "
  794.  %"at", "number" "dollar", "percent", "and": @ # $ % &
  795.  %           "hat", "star", "plus", "tilde": ^ * + ~
  796.  %
  797.  %%%%%%%%%%%%%%%%%%%%%%%%
  798.  %
  799.  % Une seule erreur de transmission peut empoisoner un programme!
  800.  %
  801.  % A single transmission error can poison a whole program.
  802.  %
  803.  %%%%%%%%%%%%%%%%%%%%%%%%
  804.